Callback for listView checkbox

Does anybody know if it's possible to associate a callback with the checkboxes in a listView?
meaning a callback that fires when somebody ticks or unticks a checkbox?
couldn't find a way myself.

thanks
Karl
kabr - Wed Oct 12 04:14:02 EDT 2011

Re: Callback for listView checkbox
Mathias Mamsch - Wed Oct 12 07:53:29 EDT 2011

Hmm ... I don't think so, but I think it is still possible to react to clicks. I think there are 'select' and 'deselect' callbacks in DXL, which will be called, whenever you change your selection. You might be able to use those to evaluate the checkbox status and therefore react to the changes. Did not verify that, but maybe it gives you an idea for exploration. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Callback for listView checkbox
a_vestlin - Wed Oct 12 08:25:33 EDT 2011

Hi

You could use the set(DBE lv, void fn(DBE, int)) function to set call back for the checkboxes. See example:

string s[] = {"A", "B"}
void checkBoxReact(DBE lv, int i)
{
    string s = get(lv, i)
        bool b = getCheck(lv, i)
        if ( b ) 
        {     
                infoBox(s " was selected")
        }
        else
        {
                infoBox(s " was deselected")
        }
}
 
DB db  = create("Test of check box reaction")
DBE lv = listView(db, listViewOptionCheckboxes, 70, 4, s)
set(lv, checkBoxReact)
realize(db)
insertColumn(lv, 0, "Option", 50, iconNone)
show(db)

 


/Anders

 

Re: Callback for listView checkbox
kabr - Wed Oct 12 10:13:18 EDT 2011

That's just what I wanted!
Many thanks, Anders!

Karl